package com.study.scala.lesson01

object gcd00 {
  def gcd(aIn:Int,bIn:Int):Int = {
    var a:Int=aIn
    var b:Int=bIn
    var t:Int=0
    var r:Int = 0
    //确保是大数除小数  
    if (a<b) {
      t=a; 
      a=b; 
      b=t;
    }
    //辗转相除    
    while((a%b)!=0)
    {
        r=a%b;        
        a=b;        
        b=r;    
    }   
    return b
  }
  def main(args: Array[String]): Unit = {
        println(gcd(99,18))
  }
}